<?php

class Stat_storeApp extends BackendApp {

    var $_store_mod;

    function __construct() {
        $this->Stat_storeApp();
    }

    function Stat_storeApp() {
        parent::__construct();
        $this->_store_mod = & m('store');
        import('datehelper.lib');
        import('statistics.lib');
        $this->import_resource(
                array(
                    'script' => 'highcharts/highcharts.js,statistics.js,jquery.ui/jquery.ui.js,jquery.ui/i18n/' . i18n_code() . '.js',
                    'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')
        );
        $this->search_arr = $_REQUEST;
        $this->assign('search_arr', $this->search_arr);
    }

    function newstore() {

        if (!$_REQUEST['search_type']) {
            $_REQUEST['search_type'] = 'day';
        }
        //初始化时间
        //天
        if (!$_REQUEST['search_time']) {
            $_REQUEST['search_time'] = date('Y-m-d', gmtime());
        }
        $search_time = strtotime($_REQUEST['search_time']); //搜索的时间
        $this->assign('search_time', $_REQUEST['search_time']);
        //周
        if (!$_REQUEST['search_time_year']) {
            $_REQUEST['search_time_year'] = date('Y', gmtime());
        }
        if (!$_REQUEST['search_time_month']) {
            $_REQUEST['search_time_month'] = date('m', gmtime());
        }
        if (!$_REQUEST['search_time_week']) {
            $_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(gmtime()));
        }
        $current_year = $_REQUEST['search_time_year'];
        $current_month = $_REQUEST['search_time_month'];
        $current_week = $_REQUEST['search_time_week'];
        $year_arr = getSystemYearArr();
        $month_arr = getSystemMonthArr();
        $week_arr = getMonthWeekArr($current_year, $current_month);

        $this->assign('current_year', $current_year);
        $this->assign('current_month', $current_month);
        $this->assign('current_week', $current_week);
        $this->assign('year_arr', $year_arr);
        $this->assign('month_arr', $month_arr);
        $this->assign('week_arr', $week_arr);

        $statlist = array(); //统计数据列表
        if ($_REQUEST['search_type'] == 'day') {
            //构造横轴数据
            for ($i = 0; $i < 24; $i++) {
                //统计图数据
                $curr_arr[$i] = 0; //今天
                $up_arr[$i] = 0; //昨天
                //统计表数据
                $uplist_arr[$i]['timetext'] = $i;
                $currlist_arr[$i]['timetext'] = $i;
                //方便搜索会员列表，计算开始时间和结束时间
                $currlist_arr[$i]['stime'] = $search_time + $i * 3600;
                $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 3600;
                $uplist_arr[$i]['val'] = 0;
                $currlist_arr[$i]['val'] = 0;
                //横轴
                $stat_arr['xAxis']['categories'][] = "$i";
            }
            $stime = $search_time - 86400; //昨天0点
            $etime = $search_time + 86400 - 1; //今天24点

            $today_day = @date('d', $search_time); //今天日期
            $yesterday_day = @date('d', $stime); //昨天日期


            $memberlist = $this->_store_mod->find(array(
                'fields' => 'count(*) as allnum ,DAY(FROM_UNIXTIME(add_time)) as dayval,HOUR(FROM_UNIXTIME(add_time)) as hourval',
                'conditions' => "add_time>{$stime} AND add_time < {$etime} group by dayval,hourval",
            ));


            if ($memberlist) {
                foreach ($memberlist as $k => $v) {
                    if ($today_day == $v['dayval']) {
                        $curr_arr[$v['hourval']] = intval($v['allnum']);
                        $currlist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                        $count_arr['up'] += intval($v['allnum']);
                    }
                    if ($yesterday_day == $v['dayval']) {
                        $up_arr[$v['hourval']] = intval($v['allnum']);
                        $uplist_arr[$v['hourval']]['val'] = intval($v['allnum']);
                        $count_arr['curr'] += intval($v['allnum']);
                    }
                }
            }
            $stat_arr['series'][0]['name'] = '昨天';
            $stat_arr['series'][0]['data'] = array_values($up_arr);
            $stat_arr['series'][1]['name'] = '今天';
            $stat_arr['series'][1]['data'] = array_values($curr_arr);

            //统计数据标题
            $statlist['headertitle'] = array('小时', '昨天', '今天', '同比');
            $this->assign('actionurl', 'index.php?app=stat_store&act=newstore&search_type=day&search_time=' . date('Y-m-d', $search_time));
        }

        if ($_REQUEST['search_type'] == 'week') {
            $current_weekarr = explode('|', $current_week);
            $stime = strtotime($current_weekarr[0]) - 86400 * 7;
            $etime = strtotime($current_weekarr[1]) + 86400 - 1;
            $up_week = @date('W', $stime); //上周
            $curr_week = @date('W', $etime); //本周
            //构造横轴数据
            for ($i = 1; $i <= 7; $i++) {
                //统计图数据
                $up_arr[$i] = 0;
                $curr_arr[$i] = 0;
                $tmp_weekarr = getSystemWeekArr();
                //统计表数据
                $uplist_arr[$i]['timetext'] = $tmp_weekarr[$i];
                $currlist_arr[$i]['timetext'] = $tmp_weekarr[$i];
                //方便搜索会员列表，计算开始时间和结束时间
                $currlist_arr[$i]['stime'] = strtotime($current_weekarr[0]) + ($i - 1) * 86400;
                $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
                $uplist_arr[$i]['val'] = 0;
                $currlist_arr[$i]['val'] = 0;
                //横轴
                $stat_arr['xAxis']['categories'][] = $tmp_weekarr[$i];
                unset($tmp_weekarr);
            }


            $memberlist = $this->_store_mod->find(array(
                'fields' => 'count(*) as allnum ,WEEKOFYEAR(FROM_UNIXTIME(add_time)) as weekval,WEEKDAY(FROM_UNIXTIME(add_time))+1 as dayofweekval ',
                'conditions' => "add_time>{$stime} AND add_time < {$etime} group by weekval,dayofweekval",
            ));


            if ($memberlist) {
                foreach ($memberlist as $k => $v) {
                    if ($up_week == $v['weekval']) {
                        $up_arr[$v['dayofweekval']] = intval($v['allnum']);
                        $uplist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                        $count_arr['up'] += intval($v['allnum']);
                    }
                    if ($curr_week == $v['weekval']) {
                        $curr_arr[$v['dayofweekval']] = intval($v['allnum']);
                        $currlist_arr[$v['dayofweekval']]['val'] = intval($v['allnum']);
                        $count_arr['curr'] += intval($v['allnum']);
                    }
                }
            }
            $stat_arr['series'][0]['name'] = '上周';
            $stat_arr['series'][0]['data'] = array_values($up_arr);
            $stat_arr['series'][1]['name'] = '本周';
            $stat_arr['series'][1]['data'] = array_values($curr_arr);
            //统计数据标题
            $statlist['headertitle'] = array('星期', '上周', '本周', '同比');
            $this->assign('actionurl', 'index.php?app=stat_store&act=newstore&search_type=week&search_time_year=' . $current_year . '&search_time_month=' . $current_month . '&search_time_week=' . $current_week);
        }

        if ($_REQUEST['search_type'] == 'month') {
            $stime = strtotime($current_year . '-' . $current_month . "-01 -1 month");
            $etime = getMonthLastDay($current_year, $current_month) + 86400 - 1;

            $up_month = date('m', $stime);
            $curr_month = date('m', $etime);
            //计算横轴的最大量（由于每个月的天数不同）
            $up_dayofmonth = date('t', $stime);
            $curr_dayofmonth = date('t', $etime);
            $x_max = $up_dayofmonth > $curr_dayofmonth ? $up_dayofmonth : $curr_dayofmonth;

            //构造横轴数据
            for ($i = 1; $i <= $x_max; $i++) {
                //统计图数据
                $up_arr[$i] = 0;
                $curr_arr[$i] = 0;
                //统计表数据
                $uplist_arr[$i]['timetext'] = $i;
                $currlist_arr[$i]['timetext'] = $i;
                //方便搜索会员列表，计算开始时间和结束时间
                $currlist_arr[$i]['stime'] = strtotime($current_year . '-' . $current_month . "-01") + ($i - 1) * 86400;
                $currlist_arr[$i]['etime'] = $currlist_arr[$i]['stime'] + 86400 - 1;
                $uplist_arr[$i]['val'] = 0;
                $currlist_arr[$i]['val'] = 0;
                //横轴
                $stat_arr['xAxis']['categories'][] = $i;
            }

            $memberlist = $this->_store_mod->find(array(
                'fields' => 'count(*) as allnum ,MONTH(FROM_UNIXTIME(add_time)) as monthval,day(FROM_UNIXTIME(add_time)) as dayval ',
                'conditions' => "add_time>{$stime} AND add_time < {$etime} group by monthval,dayval",
            ));

            if ($memberlist) {
                foreach ($memberlist as $k => $v) {
                    if ($up_month == $v['monthval']) {
                        $up_arr[$v['dayval']] = intval($v['allnum']);
                        $uplist_arr[$v['dayval']]['val'] = intval($v['allnum']);
                        $count_arr['up'] += intval($v['allnum']);
                    }
                    if ($curr_month == $v['monthval']) {
                        $curr_arr[$v['dayval']] = intval($v['allnum']);
                        $currlist_arr[$v['dayval']]['val'] = intval($v['allnum']);
                        $count_arr['curr'] += intval($v['allnum']);
                    }
                }
            }
            $stat_arr['series'][0]['name'] = '上月';
            $stat_arr['series'][0]['data'] = array_values($up_arr);
            $stat_arr['series'][1]['name'] = '本月';
            $stat_arr['series'][1]['data'] = array_values($curr_arr);
            //统计数据标题
            $statlist['headertitle'] = array('日期', '上月', '本月', '同比');
            $this->assign('actionurl', 'index.php?app=stat_store&act=newstore&search_type=month&search_time_year=' . $current_year . '&search_time_month=' . $current_month);
        }

        //计算同比
        foreach ((array) $currlist_arr as $k => $v) {
            $tmp = array();
            $tmp['seartime'] = $v['stime'] . '|' . $v['etime'];
            $tmp['timetext'] = $v['timetext'];
            $tmp['currentdata'] = $v['val'];
            $tmp['updata'] = $uplist_arr[$k]['val'];
            $tmp['tbrate'] = getTb($tmp['updata'], $tmp['currentdata']);
            $statlist['data'][] = $tmp;
        }
        $count_arr['tbrate'] = getTb($count_arr['up'], $count_arr['curr']);

        //导出Excel
        if ($_GET['exporttype'] == 'excel') {
            //导出Excel
            import('excel.lib');
            $excel_obj = new Excel();
            $excel_data = array();
            //设置样式
            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
            //header
            foreach ($statlist['headertitle'] as $v) {
                $excel_data[0][] = array('styleid' => 's_title', 'data' => $v);
            }
            //data
            foreach ($statlist['data'] as $k => $v) {
                $excel_data[$k + 1][] = array('data' => $v['timetext']);
                $excel_data[$k + 1][] = array('format' => 'Number', 'data' => $v['updata']);
                $excel_data[$k + 1][] = array('format' => 'Number', 'data' => $v['currentdata']);
                $excel_data[$k + 1][] = array('data' => $v['tbrate']);
            }
            $excel_data = $excel_obj->charset($excel_data, CHARSET);
            $excel_obj->addArray($excel_data);
            $excel_obj->addWorksheet($excel_obj->charset('新增店铺统计', CHARSET));
            $excel_obj->generateXML($excel_obj->charset('新增店铺统计', CHARSET) . date('Y-m-d-H', time()));
            exit();
        } else {
            //得到统计图数据
            $stat_arr['title'] = '新增店铺统计';
            $stat_arr['yAxis'] = '新增店铺数';
            $stat_json = getStatData_LineLabels($stat_arr);
            $this->assign('stat_json', $stat_json);
            $this->assign('statlist', $statlist);
            $this->_curmenu('stat_store_newstore');
            $this->assign('count_arr', $count_arr);
            $this->display('stat_store.newstore.html');
        }
    }

    public function showstore() {
        $where = array();
        if (in_array($_GET['type'], array('newbyday', 'newbyweek', 'newbymonth'))) {
            $actionurl = 'index.php?app=stat_store&act=showstore&type=newbyday&t=' . $_GET['t'];
            $searchtime_arr = explode('|', $_GET['t']);
            $conditions = "add_time>{$searchtime_arr[0]} AND add_time < {$searchtime_arr[1]}";
        }
        if ($_GET['exporttype'] == 'excel') {
            $store_list = $this->_store_mod->find(array(
                'join' => 'belongs_to_user',
                'fields' => 'this.*,member.user_name',
                'conditions' => $conditions,
                    )
            );
        } else {
            $page = $this->_get_page(10);
            $store_list = $this->_store_mod->find(array(
                'join' => 'belongs_to_user',
                'fields' => 'this.*,member.user_name',
                'conditions' => $conditions,
                'limit' => $page['limit'],
                'count' => true,
                    )
            );
            $page['item_count'] = $this->_store_mod->getCount();
            $this->_format_page($page);
            $this->assign('page_info', $page);
        }
        //店铺等级
        $sgrade_mod = & m('sgrade');
        $grades = $sgrade_mod->get_options();
        $this->assign('sgrades', $grades);
        
        foreach ($store_list as $key => $store)
        {
            $store_list[$key]['sgrade'] = $grades[$store['sgrade']];
        }


        //导出Excel
        if ($_GET['exporttype'] == 'excel') {
            //导出Excel
            import('excel.lib');
            $excel_obj = new Excel();
            $excel_data = array();
            //设置样式
            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
            //header
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '店铺名称');
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '店主名');
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '用户名');
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '联系电话');
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '所属等级');
            $excel_data[0][] = array('styleid' => 's_title', 'data' => '有效期至');
            //data
            foreach ($store_list as $k => $v) {
                $excel_data[$k + 1][] = array('data' => $v['store_name']);
                $excel_data[$k + 1][] = array('data' => $v['owner_name']);
                $excel_data[$k + 1][] = array('data' => $v['user_name']);
                $excel_data[$k + 1][] = array('data' => $v['tel']);
                $excel_data[$k + 1][] = array('data' => $v['sgrade']);
                $excel_data[$k + 1][] = array('data' => $v['add_time'] ? date('Y-m-d', $v['end_time']) : '无限制');
            }
            $excel_data = $excel_obj->charset($excel_data, CHARSET);
            $excel_obj->addArray($excel_data);
            $excel_obj->addWorksheet($excel_obj->charset('新增店铺', CHARSET));
            $excel_obj->generateXML($excel_obj->charset('新增店铺', CHARSET) . date('Y-m-d-H', time()));
            exit();
        }

        $this->assign('actionurl', $actionurl);
        $this->assign('store_list', $store_list);
        $this->_curmenu('stat_store_newstore');
        $this->display('stat_store.showstore.html');
    }

    function rank() {
        if (!$_REQUEST['search_type']) {
            $_REQUEST['search_type'] = 'day';
        }

        $conditions = "1=1 ";
        $conditions .= $this->_get_query_conditions(array(
            array(
                'field' => 'status',
                'equal' => '=',
                'type' => 'numeric',
            ),
        ));

        //初始化时间
        //天
        if (!$_REQUEST['search_time']) {
            $_REQUEST['search_time'] = date('Y-m-d', gmtime());
        }
        $search_time = strtotime($_REQUEST['search_time']); //搜索的时间
        $this->assign('search_time', $_REQUEST['search_time']);
        //周
        if (!$_REQUEST['search_time_year']) {
            $_REQUEST['search_time_year'] = date('Y', gmtime());
        }
        if (!$_REQUEST['search_time_month']) {
            $_REQUEST['search_time_month'] = date('m', gmtime());
        }
        if (!$_REQUEST['search_time_week']) {
            $_REQUEST['search_time_week'] = implode('|', getWeek_SdateAndEdate(gmtime()));
        }
        $current_year = $_REQUEST['search_time_year'];
        $current_month = $_REQUEST['search_time_month'];
        $current_week = $_REQUEST['search_time_week'];
        $year_arr = getSystemYearArr();
        $month_arr = getSystemMonthArr();
        $week_arr = getMonthWeekArr($current_year, $current_month);

        $this->assign('current_year', $current_year);
        $this->assign('current_month', $current_month);
        $this->assign('current_week', $current_week);
        $this->assign('year_arr', $year_arr);
        $this->assign('month_arr', $month_arr);
        $this->assign('week_arr', $week_arr);

        if ($_REQUEST['search_type'] == 'day') {
            $stime = $search_time; //昨天0点
            $etime = $search_time + 86400 - 1; //今天24点
            $this->assign('actionurl', 'index.php?app=stat_store&act=rank&search_type=day&search_time=' . date('Y-m-d', $search_time));
        }
        if ($_REQUEST['search_type'] == 'week') {
            $current_weekarr = explode('|', $current_week);
            $stime = strtotime($current_weekarr[0]) - 86400 * 7;
            $etime = strtotime($current_weekarr[1]) + 86400 - 1;
            $this->assign('actionurl', 'index.php?app=stat_store&act=rank&search_type=week&search_time_year=' . $current_year . '&search_time_month=' . $current_month . '&search_time_week=' . $current_week);
        }
        if ($_REQUEST['search_type'] == 'month') {
            $stime = strtotime($current_year . '-' . $current_month . "-01 0 month");
            $etime = getMonthLastDay($current_year, $current_month) + 86400 - 1;
            $this->assign('actionurl', 'index.php?app=stat_store&act=rank&search_type=month&search_time_year=' . $current_year . '&search_time_month=' . $current_month);
        }

        $conditions .= " AND add_time>{$stime} AND add_time < {$etime}  group by seller_id";

        $order_mod = & m('order');
        //得到统计图数据
        if (trim($_GET['stat_type']) == 'sale_amount') {
            $store_list = $order_mod->find(array(
                'fields' => 'sum(order_amount) as allnum,seller_name',
                'conditions' => $conditions,
                'order' => 'allnum desc',
                'limit' => 15,
            ));

            $statlist['headertitle'] = array('排名', '店铺名称', '销售额');
            $stat_arr['title'] = '店铺销售额排行Top15';
            $stat_arr['yAxis'] = '销售额';
            $stat_arr['series'][0]['name'] = '销售额';
        } else {
            $store_list = $order_mod->find(array(
                'fields' => 'count(*) as allnum,seller_name',
                'conditions' => $conditions,
                'order' => 'allnum desc',
                'limit' => 15,
            ));

            $statlist['headertitle'] = array('排名', '店铺名称', '订单量');
            $stat_arr['title'] = '店铺订单量排行Top15';
            $stat_arr['yAxis'] = '订单量';
            $stat_arr['series'][0]['name'] = '订单量';
        }
        $store_list = array_merge($store_list);
        //导出Excel
        if ($_GET['exporttype'] == 'excel') {
            //导出Excel
            import('excel.lib');
            $excel_obj = new Excel();
            $excel_data = array();
            //设置样式
            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
            //header
            foreach ($statlist['headertitle'] as $v) {
                $excel_data[0][] = array('styleid' => 's_title', 'data' => $v);
            }
            //data
            foreach ($store_list as $k => $v) {
                $excel_data[$k + 1][] = array('data' => $k + 1);
                $excel_data[$k + 1][] = array('data' => $v['seller_name']);
                $excel_data[$k + 1][] = array('data' => $v['allnum']);
            }
            $excel_data = $excel_obj->charset($excel_data, CHARSET);
            $excel_obj->addArray($excel_data);
            if (trim($_GET['stat_type']) == 'sale_amount') {
                $excel_obj->addWorksheet($excel_obj->charset('店铺销售额排行Top15', CHARSET));
                $excel_obj->generateXML($excel_obj->charset('店铺销售额排行Top15', CHARSET) . date('Y-m-d-H', time()));
            } else {
                $excel_obj->addWorksheet($excel_obj->charset('店铺订单量排行Top15', CHARSET));
                $excel_obj->generateXML($excel_obj->charset('店铺订单量排行Top15', CHARSET) . date('Y-m-d-H', time()));
            }
            exit();
        } else {
            $stat_arr['series'][0]['data'] = array();
            for ($i = 0; $i < 15; $i++) {
                $stat_arr['series'][0]['data'][] = array('name' => strval($store_list[$i]['store_name']), 'y' => floatval($store_list[$i]['allnum']));
            }
            //构造横轴数据
            for ($i = 1; $i <= 15; $i++) {
                //横轴
                $stat_arr['xAxis']['categories'][] = $i;
            }
            $stat_arr['legend']['enabled'] = false;
            $stat_json = getStatData_Column2D($stat_arr);
            //总数统计

            $amount = $order_mod->getOne("SELECT count(*) as allnum FROM {$order_mod->table} WHERE " . $conditions);
            $sale = $order_mod->getOne("SELECT sum(order_amount) as allnum  FROM {$order_mod->table} WHERE " . $conditions);

            $this->assign('sum_data', array($amount, $sale));
            $this->assign('stat_json', $stat_json);
            $this->assign('statlist', $statlist);
            $this->assign('store_list', $store_list);

            $this->assign('order_status_list', array(
                ORDER_PENDING => Lang::get('order_pending'),
                ORDER_SUBMITTED => Lang::get('order_submitted'),
                ORDER_ACCEPTED => Lang::get('order_accepted'),
                ORDER_SHIPPED => Lang::get('order_shipped'),
                ORDER_FINISHED => Lang::get('order_finished'),
                ORDER_CANCELED => Lang::get('order_canceled'),
            ));
            $this->_curmenu('stat_store_rank');
            $this->display('stat_store.rank.html');
        }
    }

    function degree() {
        $memberlist = $this->_store_mod->find(array(
            'fields' => ' count(*) as allnum,sgrade',
            'conditions' => '1=1 group by sgrade'
        ));

        $sgrade_mod = &m('sgrade');
        $sd_list = $sgrade_mod->find();


        $statlist['headertitle'] = array();
        $statlist['data'] = array();
        //处理数组数据
        if (!empty($memberlist)) {
            foreach ($memberlist as $k => $v) {
                $memberlist[$k]['p_name'] = $sd_list[$v['sgrade']]['grade_name'];
                $memberlist[$k]['allnum'] = intval($v['allnum']);
                $statlist['headertitle'][] = $sd_list[$v['sgrade']]['grade_name'];
                $statlist['data'][] = $v['allnum'];
            }
        }
        //导出Excel
        if ($_GET['exporttype'] == 'excel') {
            //导出Excel
            import('excel.lib');
            $excel_obj = new Excel();
            $excel_data = array();
            //设置样式
            $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
            //header
            foreach ($statlist['headertitle'] as $v) {
                $excel_data[0][] = array('styleid' => 's_title', 'data' => $v);
            }
            //data
            foreach ($statlist['data'] as $k => $v) {
                $excel_data[1][] = array('data' => $v);
            }
            $excel_data = $excel_obj->charset($excel_data, CHARSET);
            $excel_obj->addArray($excel_data);
            $excel_obj->addWorksheet($excel_obj->charset('店铺等级统计', CHARSET));
            $excel_obj->generateXML($excel_obj->charset('店铺等级统计', CHARSET) . date('Y-m-d-H', time()));
            exit();
        } else {
            $this->assign('actionurl', 'index.php?app=stat_store&act=degree');
            $data = array(
                'title' => '店铺等级统计',
                'name' => '店铺个数',
                'label_show' => true,
                'series' => $memberlist
            );
            $this->assign('stat_json', getStatData_Pie($data));
            $this->_curmenu('stat_store_degree');
            $this->display('stat_store.degree.html');
        }
    }

    function _get_member_submenu() {
        $submenus = array(
            array(
                'name' => 'stat_store_newstore',
                'url' => 'index.php?app=stat_store&amp;act=newstore',
            ),
            array(
                'name' => 'stat_store_rank',
                'url' => 'index.php?app=stat_store&amp;act=rank',
            ),
            array(
                'name' => 'stat_store_degree',
                'url' => 'index.php?app=stat_store&amp;act=degree',
            ),
        );
        return $submenus;
    }

}

?>
